home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / dfpp01.zip / MOUSE.H < prev    next >
C/C++ Source or Header  |  1992-11-21  |  2KB  |  63 lines

  1. // ---------- mouse.h
  2.  
  3. #ifndef MOUSE_H
  4. #define MOUSE_H
  5.  
  6. #include <dos.h>
  7. #include "dfwindow.h"
  8. #include "timer.h"
  9.  
  10. class Mouse    {
  11.     Bool installed;      // True = mouse is installed
  12.     char *statebuffer;   // mouse state buffer
  13.     Timer doubletimer;   // mouse double-click timer
  14.     Timer delaytimer;    // mouse typematic click timer
  15.     int prevx;           // previous mouse x coordinate
  16.     int prevy;           // previous mouse y coordinate
  17.     int clickx;          // click x position
  18.     int clicky;          // click y position
  19.     int releasex;        // release x position
  20.     int releasey;        // release y position
  21.     union REGS regs;
  22.     DFWindow *MouseWindow(int mx, int my);
  23.     void CallMouse(int m1,int m2=0,int m3=0,int m4=0,unsigned es=0);
  24.     void DispatchRelease();
  25.     void DispatchMove();
  26.     void DispatchLeftButton();
  27. public:
  28.     Mouse();
  29.     ~Mouse();
  30.     Bool Installed() { return installed; }
  31.     void GetPosition(int &x, int &y); // get mouse position
  32.     void SetPosition(int x, int y);   // set mouse position
  33.     Bool Moved();           // True if mouse has moved
  34.     void Show();            // show the mouse cursor
  35.     void Hide();            // hide the mouse cursor
  36.     Bool LeftButton();     // True if left button is pressed
  37.     Bool ButtonReleased(); // True if button was released
  38.     void SetTravel(int minx, int maxx, int miny, int maxy);
  39.     void DispatchEvent();
  40. };
  41.  
  42. const int MOUSE          = 0x33;  // mouse interrupt vector
  43. // -------- mouse commands
  44. const int RESETMOUSE     =  0;
  45. const int SHOWMOUSE      =  1;
  46. const int HIDEMOUSE      =  2;
  47. const int READMOUSE      =  3;
  48. const int SETPOSITION    =  4;
  49. const int BUTTONRELEASED =  6;
  50. const int XLIMIT         =  7;
  51. const int YLIMIT         =  8;
  52. const int BUFFSIZE       = 21;
  53. const int SAVESTATE      = 22;
  54. const int RESTORESTATE   = 23;
  55. // -------- timer delays for mouse repeat, double clicks
  56. const int DELAYTICKS     =  1;
  57. const int FIRSTDELAY     =  7;
  58. const int DOUBLETICKS    =  5;
  59.  
  60. #endif
  61.  
  62.  
  63.